package win.zxshuo.www.controller.validators;

import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
 * Author:rffanlab
 * Created:2018/4/8
 */
public class UserValidator {

    @NotBlank(message = "用户名不能为空",groups = Username.class)
    private String username;

    @NotBlank(groups = Password.class,message = "密码不能为空")
    @Length(min = 8,message = "密码不能小于8位",groups = Password.class)
    private String password;

    @NotBlank(message = "手机号码不能留空",groups = Mobile.class)
    @Pattern(regexp = "^((13[0-9])|(14[5,7])|(15[0-3,5-9])|(17[0,3,5-8])|(18[0-9])|166|198|199|(147))\\d{8}$",message = "请输入正确的国内11位手机号",groups = Mobile.class)
    private String mobile;

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public interface Username{}

    public interface Password{}

    public interface Mobile{}

}
